package main

import (
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"github.com/jinzhu/gorm"
)

func main() {
	db, err := gorm.Open("mysql", "root:root@(127.0.0.1)/test?charset=utf8&parseTime=True&loc=Local")
	if err != nil {
		panic(err)
	}
	defer db.Close()
	//新建空的stu
	stu := new(Student)
	err = db.Table("tb_stu").Model(stu).Where("id = ?", 5).Update("name", "张三").Error
	if err != nil {
		fmt.Println(err)
	}
}
